<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<p:tabView>
		<p:tab title="Basic info">
			<h:panelGrid id="productInfoInputPanel" columns="2"
				style="width:100%">
				<h:outputText value="id" />
				<h:outputText value="#{productModel.current.id}" />
				<h:outputText value="Supplier" />
				<h:panelGrid columns="2">
					<h:outputText
						value="#{productModel.current.supplier.name}  (#{productModel.current.supplier.address})  " />
					<p:commandButton actionListener="#{supplierController.init}"
						ajax="true" update=":dialogForm,:headerForm" value="Choose"
						oncomplete="supplierDlg.show()"></p:commandButton>
				</h:panelGrid>
				<h:outputText value="Name" />
				<h:panelGrid columns="5" style="width:100%">
					<h:inputText value="#{productModel.current.name}" />
					<h:outputText value="Chinese" />
					<h:inputText value="#{productModel.current.chineseName}" />
					<h:outputText value="French" />
					<h:inputText value="#{productModel.current.frenchName}" />
				</h:panelGrid>
				<h:outputText value="Number" />
				<h:inputText value="#{productModel.current.number}" />
				<h:outputText value="Storage Location" />
				<h:inputText value="#{productModel.current.storageLocation}" />
				<h:outputText value="Is Organic" />
				<p:selectBooleanCheckbox value="#{productModel.current.isOrganic}"  itemLabel="Is Organic"/>
				<h:outputText value="Is Taxable" />
				<p:selectBooleanCheckbox value="#{productModel.current.isTaxable}" itemLabel="Is Taxable"/>
				<h:outputText value="Is Frozen Food" />
				<p:selectBooleanCheckbox value="#{productModel.current.isFrozenFood}" itemLabel="Is Frozen Food"/>
				<ui:remove>
					<h:outputText value="Is FreshFood" />
					<h:selectBooleanCheckbox
						value="#{productModel.current.isFreshFood}"></h:selectBooleanCheckbox>
				</ui:remove>
				<h:outputText value="Type" />
				<p:selectOneMenu value="#{productModel.current.type}">
					<f:selectItems value="#{productModel.availableTypes}"></f:selectItems>
				</p:selectOneMenu>
				<h:outputText value="From" />
				<p:selectOneMenu value="#{productModel.current.source}">
					<f:selectItems value="#{productModel.availableSources}"></f:selectItems>
				</p:selectOneMenu>
				<h:outputText value="Place of origin" />
				<h:inputText value="#{productModel.current.origin}" />
				<h:outputText value="Status" />
				<p:selectOneMenu value="#{productModel.current.status}">
					<f:selectItems value="#{productModel.availableStatuses}"></f:selectItems>
				</p:selectOneMenu>
				<h:outputText value="Price" />
				<p:inputText value="#{productModel.current.price}"
					style="text-align:right">
					<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
				</p:inputText>
				<h:outputText value="Special Price" />
				<p:inputText value="#{productModel.current.specialPrice}"
					style="text-align:right">
					<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
				</p:inputText>
				<h:outputText value="Inventory" />
				<h:inputText value="#{productModel.current.inventory}"
					style="text-align:right" />
				<h:outputText value="Stock unit" />
				<h:panelGrid columns="5">
					<h:inputText value="#{productModel.current.stockUnit}" />
					<h:outputText value="Chinese" />
					<h:inputText value="#{productModel.current.chineseStockUnit}" />
					<h:outputText value="French" />
					<h:inputText value="#{productModel.current.frenchStockUnit}" />
				</h:panelGrid>
				<h:outputText
					value="Specification(Ratio of stock unit and price unit)" />
				<h:inputText value="#{productModel.current.specification}" />
				<h:outputText value="Spec desc (approx. 2lb)"
					title="Specification Description of stock unit" />
				<h:panelGrid columns="5">
					<h:inputText value="#{productModel.current.specificationDesc}" />
					<h:outputText value="Chinese" />
					<h:inputText
						value="#{productModel.current.chineseSpecificationDesc}" />
					<h:outputText value="French" />
					<h:inputText
						value="#{productModel.current.frenchSpecificationDesc}" />
				</h:panelGrid>
				<h:outputText value="Price Unit (each,pc)" />
				<h:panelGrid columns="5">
					<h:inputText value="#{productModel.current.priceUnit}" />
					<h:outputText value="Chinese" />
					<h:inputText value="#{productModel.current.chinesePriceUnit}" />
					<h:outputText value="French" />
					<h:inputText value="#{productModel.current.frenchPriceUnit}" />
				</h:panelGrid>
				<h:outputText value="Purchase Price" />
				<h:inputText value="#{productModel.current.purchasePrice}" />
				<h:outputText value="Purchase Unit" />
				<h:inputText value="#{productModel.current.purchaseUnit}" />
				<h:outputText value="Purchase to Price"
					title="How many stock unit in purchase unit" />
				<h:panelGrid columns="2">
					<p:inputText value="#{productModel.current.purchaseToPriceSpec}"
						style="text-align:right">
						<f:convertNumber minFractionDigits="0" maxFractionDigits="0" />
					</p:inputText>
					<h:outputText value=" (eg 1box=30bag,input 30)" />
				</h:panelGrid>
				<h:outputText value="Unit Price ($0.55/100g)" />
				<h:panelGrid columns="5">
					<h:inputText value="#{productModel.current.unitPrice}" />
					<h:outputText value="Chinese" />
					<h:inputText value="#{productModel.current.chineseUnitPrice}" />
					<h:outputText value="French" />
					<h:inputText value="#{productModel.current.frenchUnitPrice}" />
				</h:panelGrid>
				<h:outputText value="Recommendation index" />
				<h:panelGroup>
					<p:spinner value="#{productModel.current.recommendIndex}" max="100"
						min="0"></p:spinner>
					<h:outputLabel value="Maximun:100  Minimun:0"></h:outputLabel>
				</h:panelGroup>
				<h:outputText value="Order Limit (Zero means no limit)" />
				<h:inputText value="#{productModel.current.orderLimit}" />
				<h:outputText value="Short message(Max. 25 characters)" />
				<h:panelGrid columns="5">
					<h:inputText value="#{productModel.current.shortMessage}" />
					<h:outputText value="Chinese" />
					<h:inputText value="#{productModel.current.chineseShortMessage}" />
					<h:outputText value="French" />
					<h:inputText value="#{productModel.current.frenchShortMessage}" />
				</h:panelGrid>
				<h:outputText value="Best before:"></h:outputText>
				<p:calendar value="#{productModel.current.bestBefore}" pattern="yyyy-MM-dd" />
			</h:panelGrid>
		</p:tab>
		<p:tab title="Extended Info">
			<h:panelGrid columns="4" style="width:100%;height:100%">
				<h:inputHidden></h:inputHidden>
				<h:outputText value="English"></h:outputText>
				<h:outputText value="Chinese"></h:outputText>
				<h:outputText value="French"></h:outputText>
				<h:outputText value="Description" style="max-width:60px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.description}"
					style="width:100%;height:150px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.chineseDescription}"
					style="width:100%;height:150px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.frenchDescription}"
					style="width:100%;height:150px" />
				<h:outputText value="Health Benefits" style="max-width:60px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.healthBenefits}"
					style="width:100%;height:150px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.chineseHealthBenefits}"
					style="width:100%;height:150px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.frenchHealthBenefits}"
					style="width:100%;height:150px" />
				<h:outputText value="Nutrition Values" style="max-width:60px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.nutritionValues}"
					style="width:100%;height:150px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.chineseNutritionValues}"
					style="width:100%;height:150px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.frenchNutritionValues}"
					style="width:100%;height:150px" />
				<h:outputText value="Ingrendients" style="max-width:60px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.ingredients}"
					style="width:100%;height:150px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.chineseIngredients}"
					style="width:100%;height:150px" />
				<p:inputTextarea
					value="#{productModel.current.productInfo.frenchIngredients}"
					style="width:100%;height:150px" />
			</h:panelGrid>
		</p:tab>

		<p:tab title="Purchase Schedules">
			<p:dataGrid var="schedule"
				value="#{productModel.currentPurchaseSchedules}" columns="1"
				rows="7">
				<p:column>
					<p:panel>
						<h:panelGrid columns="6">
							<h:outputText value="#{schedule.id}" />
							<p:selectBooleanCheckbox value="#{schedule.selected}"
								itemLabel="#{schedule.dayOfWeek.label}" style="width:100px" />
							<p:spinner value="#{schedule.purchaseHour}" min="0" max="23"
								size="1" suffix="h"></p:spinner>
							<p:spinner value="#{schedule.purchaseMinute}" min="0" max="59"
								size="1" suffix="m" stepFactor="10"></p:spinner>
						</h:panelGrid>
					</p:panel>
				</p:column>
			</p:dataGrid>
		</p:tab>
		<p:tab title="Icons">
			<h:panelGrid columns="2">
				<h:outputText value="Icon" />
				<p:commandButton value="Choose icons" ajax="true"
					update=":chooseIconForm" oncomplete="chooseIconDlg.show()"></p:commandButton>
				<h:outputText value="16.png"></h:outputText>
				<p:graphicImage value="#{productModel.current.icon16DataStream}"
					rendered="#{productModel.current.icon16DataStream != null}"></p:graphicImage>
				<h:graphicImage value="../#{productModel.current.icon}16.png"
					rendered="#{productModel.current.icon16DataStream == null}"></h:graphicImage>
				<h:outputText value="32.png"></h:outputText>
				<p:graphicImage value="#{productModel.current.icon32DataStream}"
					rendered="#{productModel.current.icon32DataStream != null}"></p:graphicImage>
				<h:graphicImage value="../#{productModel.current.icon}32.png"
					rendered="#{productModel.current.icon32DataStream == null}"></h:graphicImage>
				<h:outputText value="64.png"></h:outputText>
				<p:graphicImage value="#{productModel.current.icon64DataStream}"
					rendered="#{productModel.current.icon64DataStream != null}"></p:graphicImage>
				<h:graphicImage value="../#{productModel.current.icon}64.png"
					rendered="#{productModel.current.icon64DataStream == null}"></h:graphicImage>
				<h:outputText value="128.png"></h:outputText>
				<p:graphicImage value="#{productModel.current.icon128DataStream}"
					rendered="#{productModel.current.icon128DataStream != null}"></p:graphicImage>
				<h:graphicImage value="../#{productModel.current.icon}128.png"
					rendered="#{productModel.current.icon128DataStream == null}"></h:graphicImage>
			</h:panelGrid>
		</p:tab>
		<p:tab title="Related pictures">
			<ui:include src="productPictureInputPanel.xhtml"></ui:include>
		</p:tab>
	</p:tabView>
</ui:composition>

</html>